<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    var str = [1,62,31,58,64,22];
    var max = str[0];
    for (var i = 1;i < str.length;i++) {
        if(str[i] > max) {
            max = str[i];
        }
    }
    console.log(max);
</script>
<body>

</body>
</html>